" some new setting {{
    let mapleader=";"

    noremap Q :q<CR>
    noremap S :w<CR>

    noremap <LEADER>st :Startify<CR>

    " Search
    noremap <LEADER>nl :nohlsearch<CR>

    " H key: go to the start of the line
    noremap <silent> H ^
    " L key: go to the end of the line
    noremap <silent> L $

    " split the screens to up (horizontal), down (horizontal), left (vertical), right (vertical)
    noremap sk :set nosplitbelow<CR>:split<CR>:set splitbelow<CR>
    noremap sj :set splitbelow<CR>:split<CR>
    noremap sh :set nosplitright<CR>:vsplit<CR>:set splitright<CR>
    noremap sl :set splitright<CR>:vsplit<CR>

    " Resize splits with arrow keys
    noremap <c-up> :res +5<CR>
    noremap <c-down> :res -5<CR>
    noremap <c-left> :vertical resize-5<CR>
    noremap <c-right> :vertical resize+5<CR>

    " Tab management
    " Create a new tab with tu
    noremap te :tabe<CR>
    " Move around tabs with tn and ti
    noremap tn :-tabnext<CR>
    noremap tp :+tabnext<CR>
    " Move the tabs with tmn and tmi
    noremap tmn :-tabmove<CR>
    noremap tmp :+tabmove<CR>
" }}

" Vim setting {{
    " 复制粘贴 {
        " nvim 需下载 xclip or xsel
        set clipboard=unnamedplus
        "vnoremap <leader>y "+y
        "nnoremap <leader>p "+p
        "vnoremap <leader>x "+x
    " }
    
    " 关闭方向键，强制使用hjkl {
        "map <Left> <Nop>
        "map <Right> <Nop>
        "map <Up> <Nop>
        "map <Down> <Nop>
    " }
    
    " 通用设置 {
        filetype on
        filetype plugin on
        set noerrorbells	    " 不让vim发出讨厌的滴滴声
        set noeb 			    " 去掉输入错误的提示
        set report=0 		    " 告诉我们文件的哪一行被改变过
    " }

    " 编码设置 {
        set langmenu=zh_CN.UTF-8
        set helplang=cn
        set termencoding=utf-8
        set encoding=utf8
        set fileencodings=utf8,gbk,cp936,gb2312,gb18030 		" 使用utf-8或gbk打开文件
    " }

    " 显示设置 {
        syntax enable 		" 开启语法高亮功能
        syntax on 			" 允许指定语法高亮配色方案替换默认方案
        filetype indent on
        set number 
        set relativenumber
        set cursorline
        set colorcolumn=80
        set t_Co=256
        set background=dark
        colorscheme gruvbox
        set nowrap 			" 禁止折行 
        set showcmd 
        set showmode  		" 命令行显示vim当前模式 
        set showmatch 
        set linespace=0 	" 字符间插入的像素行数目 
        set matchtime=1 	" 匹配括号高亮的时间（单位是十分之一秒）		
        set backspace=2 	" 使用回格键正常处理indent,eol,start等 
        set cmdheight=2 
        set laststatus=0    " 显示状态栏 
        set scrolloff=3 	" 光标移动到buffer的顶部和底部时保持3行的距离 
        set tabstop=4 		" 设置编辑时制表符占用空格数
        set softtabstop=4
        set shiftwidth=4
        set smartindent
        set expandtab 		" 将制表符扩展为空格
        set smarttab		" 在行和段开始处使用制表符
        set history=1000
        set fillchars=vert:\ ,stl:\ ,stlnc:\ 	" 在被分割的窗口间显示空白，便于阅读
        set iskeyword+=_,$,@,%,#,-				" 带有如下符号的单词不要被换行分割
        set whichwrap+=<,>,h,l 					" 允许backspace和光标键跨越行边界
        "set listchars=tab:\|\ ,trail:▫
        set listchars=tab:\|\ ,trail:-
    " }

    " 搜索设置 {
        set hlsearch 		" 高亮显示搜索结果
        set incsearch 		" 开启实时搜索功能
        set ignorecase 		" 搜索时大小写不敏感
        set magic 			" 设置魔术
    " }

    " 代码折叠 {
        set foldmethod=indent
        "set foldmethod=syntax
        set nofoldenable 	" 启动vim时关闭折叠代码
        "set foldenable
        "使用zc按键来创建折叠，使用za来打开或者关闭折叠,za经常会误输入，可以用空格键来替代za
        "nnoremap <space> za
    " }

    " 其它设置 {
        set wildmenu      " vim自身命令行模式智能补全
        set nobackup
        set nowritebackup
        set noswapfile
        set noundofile
        set autoread      " 文件在vim之外修改过，自动重新读入
        set autowrite     " 设置自动保存
        set confirm       " 在处理未保存或只读文件的时候，弹出确认
        set splitbelow
        "set splitright
        set ma
    " }

    " 分屏设置 {
        nnoremap <C-J> <C-W><C-J>
        nnoremap <C-K> <C-W><C-K>
        nnoremap <C-L> <C-W><C-L>
        nnoremap <C-H> <C-W><C-H>
    " }
" }}
